Skip to main content

mediaFoundationMediaTypeSetAttribute

Type

command

Summary

Set an attribute of a media type Platform:desktop

Syntax

mediaFoundationMediaTypeSetAttribute <pMediaTypeID>, <pAttribute>, <pValue>

Description

The media must already be created with mediaFoundationCreateMediaType or via another API that returns a media type ID.

The following attributes are currently supported:

  • "major type": One of the following
   - \"media type default\"
- \"media type audio\"
- \"media type video\"
- \"media type protected\"
- \"media type sami\"
- \"media type script\"
- \"media type image\"
- \"media type html\"
- \"media type binary\"
- \"media type file transfer\"
- \"media type stream\"
- \"subtype\": One of the following:
- \"video format RGB32\"
- \"video format ARGB32\"
- \"video format RGB24\"
- \"video format RGB555\"
- \"video format RGB565\"
- \"video format RGB8\"
- \"video format AI44\"
- \"video format AYUV\"
- \"video format YUY2\"
- \"video format YVYU\"
- \"video format YVU9\"
- \"video format UYVY\"
- \"video format NV11\"
- \"video format NV12\"
- \"video format YV12\"
- \"video format I420\"
- \"video format IYUV\"
- \"video format Y210\"
- \"video format Y216\"
- \"video format Y410\"
- \"video format Y416\"
- \"video format Y41P\"
- \"video format Y41T\"
- \"video format Y42T\"
- \"video format P210\"
- \"video format P216\"
- \"video format P010\"
- \"video format P016\"
- \"video format v210\"
- \"video format v216\"
- \"video format v410\"
- \"video format MP43\"
- \"video format MP4S\"
- \"video format M4S2\"
- \"video format MP4V\"
- \"video format WMV1\"
- \"video format WMV2\"
- \"video format WMV3\"
- \"video format WVC1\"
- \"video format MSS1\"
- \"video format MSS2\"
- \"video format MPG1\"
- \"video format DVSL\"
- \"video format DVSD\"
- \"video format DVHD\"
- \"video format DV25\"
- \"video format DV50\"
- \"video format DVH1\"
- \"video format DVC\"
- \"video format H264\"
- \"video format MJPG\"
- \"video format 4200\"
- \"video format HEVC\"
- \"video format HEVC ES\"
- \"video format DVC\"
- \"video format MPEG2\"
- \"video format H264 ES\"
- \"audio format PCM\"
- \"audio format Float\"
- \"audio format DTS\"
- \"audio format Dolby AC3 SPDIF\"
- \"audio format DRM\"
- \"audio format WMAudioV8\"
- \"audio format WMAudioV9\"
- \"audio format WMAudio Lossless\"
- \"audio format WMASPDIF\"
- \"audio format MSP1\"
- \"audio format MP3\"
- \"audio format MPEG\"
- \"audio format AAC\"
- \"audio format ADTS\"
- \"audio format AMR NB\"
- \"audio format AMR WB\"
- \"audio format AMR WP\"
- \"audio format Dolby AC3\"
- \"audio format Dolby DDPlus\"
- \"all samples independent\" (boolean): Specifies for a media type whether each sample is independent of the other samples in the stream.
- \"fixed size samples\" (boolean): Specifies for a media type whether the samples have a fixed size
- \"compressed\" (boolean): If this attribute is true, the media type is a compressed format. Otherwise, either the media type is uncompressed or the compression type is not known.
- \"sample size\" (integer): Specifies the size of each sample, in bytes, in a media type.
- \"audio num channels\" (integer): Number of audio channels in an audio media type.
- \"audio samples per second\" (integer): Number of audio samples per second in an audio media type.
- \"audio avg bytes per second\" (integer): Average number of bytes per second in an audio media type.
- \"audio block alignment\" (integer): Block alignment, in bytes, for an audio media type. The block alignment is the minimum atomic unit of data for the audio format.
- \"audio bits per sample\" (integer): Number of bits per audio sample in an audio media type.
- \"audio valid bits per sample\" (integer): Number of valid bits of audio data in each audio sample.
- \"audio samples per block\" (integer): Number of audio samples contained in one compressed block of audio data. This attribute can be used in compressed audio formats that have a fixed number of samples within each block.
- \"audio channel mask\" (integer): In an audio media type, specifies the assignment of audio channels to speaker positions. The value of this attribute is a bitwise OR of the following flags:
- SPEAKER_FRONT_LEFT (0x1)
- SPEAKER_FRONT_RIGHT (0x2)
- SPEAKER_FRONT_CENTER (0x4)
- SPEAKER_LOW_FREQUENCY (0x8)
- SPEAKER_BACK_LEFT (0x10)
- SPEAKER_BACK_RIGHT (0x20)
- SPEAKER_FRONT_LEFT_OF_CENTER (0x40)
- SPEAKER_FRONT_RIGHT_OF_CENTER (0x80)
- SPEAKER_BACK_CENTER (0x100)
- SPEAKER_SIDE_LEFT (0x200)
- SPEAKER_SIDE_RIGHT (0x400)
- SPEAKER_TOP_CENTER (0x800)
- SPEAKER_TOP_FRONT_LEFT (0x1000)
- SPEAKER_TOP_FRONT_CENTER (0x2000)
- SPEAKER_TOP_FRONT_RIGHT (0x4000)
- SPEAKER_TOP_BACK_LEFT (0x8000)
- SPEAKER_TOP_BACK_CENTER (0x10000)
- SPEAKER_TOP_BACK_RIGHT (0x20000)
- \"video frame size\": Width,height of a video frame, in pixels.
- \"video frame rate\": The frame rate is expressed as a numertor,denomitator ratio. For example, if the frame rate is 30 frames per second (fps), the ratio is 30,1. If the frame rate is 29.97 fps, the ratio is 30000,1001.
- \"video aspect ratio\": An X,Y pair
- \"video avg bitrate\" (integer): Approximate data rate of the video stream, in bits per second, for a video media type.
- \"video interlace mode\" (integer): Describes how the frames in a video media type are interlaced. Use the following constants for this property:

constant kMFVideoInterlace_Progressive = 2

      constant kMFVideoInterlace_FieldInterleavedUpperFirst = 3
constant kMFVideoInterlace_FieldInterleavedLowerFirst = 4
constant kMFVideoInterlace_FieldSingleUpper = 5
constant kMFVideoInterlace_FieldSingleLower = 6
constant kMFVideoInterlace_MixedInterlaceOrProgressive = 7
*Note

*:See the mediaFoundationTranscode documentation for a complete example of using this handler.

Parameters

NameTypeDescription

pMediaTypeID

integer

A media type ID

pAttribute

string

The name of the attribute

pValue

string

The value to set the attribute to

command: mediaFoundationTranscode, mediaFoundationCreateMediaType

Compatibility and Support

OS

windows

Thank you for your feedback!

Was this page helpful?